<?php
/** this is phpologna SVN **/
include "config.php";
mysql_connect($DBhost,$DBuser,$DBpassword);
mysql_selectdb($DBname);
$config['tpl']="default";

include "functions.php";

/* Replace this crap with some security measures! */
$show=$_GET['show'];
$study=$_GET['study'];
$module=$_GET['module'];

switch ($show) {
case "studies":
	$title = "Studiengänge";
	$query = mysql_query ("SELECT * FROM studies");
	break;

case "modules":
	$title = "Module";
	$query = mysql_query ("SELECT * FROM modules");
	if (isset($_GET['study'])) {
		$query = mysql_query ("SELECT * FROM modules WHERE study = ".$study);
		$topline = "Zeige Module zum Studiengang <i>".title($study,"studies")."</i>"; }
	break;

case "module":
	$title="Modul ".title($module,"modules");

	break;

default:
	$title="Home";
	$content.="Willkommen bei <i>phpologna - be your own pruefungsamt</i>!";
	$content.=box("Bitte einen Menüeintrag wählen!");
}

if (isset($topline)) $content.="<div>".$topline."</div>";

if (isset($query)) $content.=show_table($query,$show);

include "tpl/".$config['tpl']."/index.php";
?>